package com.dnjn.happiness.emo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dnjn.happiness.emo.domain.HappyLevel;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 * 分档 Mapper 接口
 * </p>
 *
 * @author Amber
 * @since 2023-10-09
 */
public interface HappyLevelMapper extends BaseMapper<HappyLevel> {
    @Select(" SELECT MAX(happiness_score) AS happinessScore,level_name FROM emo_happy_level WHERE happiness_score <= #{happinessScore} AND deleted = '0' ")
    HappyLevel getLevelByUserHappinessScore(Long happinessScore);

    @Select(" SELECT MAX(happiness_score) AS maxScore FROM emo_happy_level WHERE deleted = '0' limit 1")
    Integer selectMaxScore();
}
